import com.study.common.TreeNode;
import org.junit.Test;

/**
 * 转圈打印所有外部节点
 * <p>
 * 20
 * /  \
 * 8   22
 * / \   \
 * 4  12  25
 * /  \
 * 10  14
 * <p>
 * 要求输出： [20, 8, 4, 10, 14, 25, 22, 20]
 */
@SuppressWarnings("all")
public class BoundaryTraversalOfBinaryTree {

    void print(TreeNode node) {
        // 190527 first
    }

    @Test
    public void test() {
        print(new TreeNode(20,
                new TreeNode(8,
                        4, new TreeNode(12,
                        10, 14)), new TreeNode(22,
                null, 25)));
    }
}













































/*
void print(TreeNode node) {
    if (node==null)
        return;

    info(node.val);
    printLeft(node.left);
    printLeaves(node.left);
    printLeaves(node.right);
    printRight(node.right);
}

void printLeft(TreeNode node) {
    if (node ==null)
        return;

    if (node.left != null) {
        info(node.val);
        printLeft(node.left);
    } else if (node.right != null) {
        info(node.val);
        printLeft(node.right);
    }
}

void printRight(TreeNode node) {
    if (node == null)
        return;

    if (node.right != null) {
        printRight(node.right);
        info(node.val);
    } else if (node.left != null) {
        printRight(node.left);
        info(node.val);
    }
}

void printLeaves(TreeNode node) {
    if (node == null)
        return;

    printLeaves(node.left);

    if (node.left == null
            && node.right == null)
        info(node.val);

    printLeaves(node.right);
}
*/
